<template>
  <div class="front-nav">
    <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
    >
      <el-menu-item>微前端</el-menu-item>
      <el-submenu index="1">
        <template slot="title">user</template>
        <!-- <el-menu-item index="1-1" @click="load">加载</el-menu-item> -->
        <el-menu-item index="2-2" @click="goBackGround">后台</el-menu-item>
        <el-menu-item index="2-2" @click="loginOut">退出</el-menu-item>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
// import { routerGo } from "@/utils/routerTo";
export default {
  data() {
    return {
      activeIndex: "1"
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    loginOut() {
      this.$store.dispatch("loginOut").then(() => {
        this.$router.push("/login");
      });
    },
    // load() {
    //   routerGo("/app1");
    // },
    goBackGround() {
      this.$router.push("/layout");
    }
  }
};
</script>

<style lang="scss" scoped>
.front-nav {
  .el-menu--horizontal {
    padding: 0 20px;
    height: 60px;
    box-sizing: border-box;
    .el-submenu {
      float: right;
    }
  }
}
</style>